using System;
using System.IO;
using System.Collections.Generic;
using System.Text;

namespace FutureOpen.Core.func.util
{
    public class DictUtil
    {
        private static Dictionary<string, int> school = null;
        private static Dictionary<string, int> company = null;
        private static Dictionary<string, int> title = null;

        private static readonly int ITEMS = 100;
                

        public static Dictionary<string, int> School()
        {
             if (school == null){
                school = LoadDict("");
            }
            return school;
        }

        public static Dictionary<string, int> Title()
        {
            //itles
            if (title == null)
            {
                title = LoadDict("");
            }
            return title;
        }

        public static Dictionary<string, int> Company()
        {
            //itles
            if (company == null)
            {
                company = LoadDict("");
            }
            return company;
        }

        public static Dictionary<string, int> LoadDict(string path)
        {
            Dictionary<string, int> dict = new Dictionary<string, int>();
            string[] lines = File.ReadAllLines(path);
            foreach (string line in lines)
            {
                string item = line.Trim().ToLower();
                if (!string.IsNullOrEmpty(item))
                {
                    dict.Add(item, ITEMS);                                        
                }               
            }
            return dict;
        }
        
    }
}
